home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 47 / 047.d81 / memory challenge (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  9KB  |  268 lines

  1. 10 m$="[157][157][157][165][191][167]":cd$="[158][207][163][208]"+m$+m$+"[157][157][157][204][164][186]"
  2. 20 dim b$(9,4),c$(36,4),l$(37),a(36),d(36),p$(4),tr(10),h(10)
  3. 30 dim n1(33),n2(33),s(20),t(20),g(30),w$(30),hs(30),le(30),j(12),k(12)
  4. 40 gosub1790:nu=1:al=1:le=16
  5. 50 forx=1to8:readn3(x),n4(x),dr(x):next
  6. 60 forx=1to36:readd(x):next
  7. 70 forx=1to12:readj(x),k(x):next
  8. 80 print"[147]":poke53281,14:poke646,1
  9. 90 print"*** memory challenge ***":print
  10. 95 print"press 'q' to quit"
  11. 100 print"how many players? (1-4):";
  12. 105 geta$:if((a$<"1")or(a$>"4"))and(a$<>"q")then105
  13. 106 printa$:k=val(a$):ifa$="q"then60000
  14. 110 ifk=1then140
  15. 120 ifk<2ork>4then90
  16. 130 goto200
  17. 140 z$(1)="":z(1)=1:print:print"enter your name:";:gosub60500:p$(1)=c$
  18. 150 print
  19. 155 print"try to uncover all of the matches in as few tries as possible"
  20. 160 poke214,20:print:print"     press the space bar to begin"
  21. 170 getq$:ifq$=""then170
  22. 180 ifq$<>chr$(32)then170
  23. 190 goto275
  24. 200 print:print"name of first player:";:gosub60500:p$(1)=c$
  25. 210 z$(1)="":z(1)=1
  26. 220 print:print"name of second player:";:gosub60500:p$(2)=c$
  27. 230 z$(2)="[159]":z(2)=3:ifk=2then275
  28. 240 print:print"name of third player:";:gosub60500:p$(3)=c$
  29. 250 z$(3)="":z(3)=6:ifk=3then275
  30. 260 print:print"name of fourth player:";:gosub60500:p$(4)=c$
  31. 270 z$(4)="[158]":z(4)=7
  32. 275 pl=1267:lo=1106:tl=0:tr=0
  33. 280 rem shuffle cards
  34. 290 print:print" please wait while i shuffle the cards."
  35. 300 a(1)=int(rnd(1)*36)+1
  36. 310 forx=2to36
  37. 320 a(x)=int(rnd(1)*36)+1
  38. 330 fory=1tox-1:ifa(x)=a(y)theny=1:goto320
  39. 340 nexty,x:print"[147]";
  40. 350 rem lay down the cards
  41. 380 forx=1to4:fory=1to9:printcd$"[145][145][145]";
  42. 390 nexty:print"";
  43. 400 nextx
  44. 410 print"           press 'q' to quit"
  45. 500 r$="":d$=""
  46. 510 l$(1)="":z=2
  47. 520 forx=1to4
  48. 530 fory=1to8:l$(z)=l$(z-1)+r$:z=z+1:nexty
  49. 540 l$(z)=l$(z-9)+d$:z=z+1
  50. 550 nextx
  51. 560 forx=1to9:fory=1to4
  52. 570 c$(a(x),y)=b$(x,y):c$(a(x+18),y)=b$(x,y)
  53. 580 nexty,x
  54. 590 rem card designs 10-18
  55. 600 c$(a(10),1)="[144][172]  ":c$(a(28),1)=c$(a(10),1):rem dog
  56. 610 c$(a(10),2)="[209] [206]":c$(a(28),2)=c$(a(10),2)
  57. 620 c$(a(10),3)="  [146] ":c$(a(28),3)=c$(a(10),3)
  58. 630 c$(a(10),4)="[170] [180]":c$(a(28),4)=c$(a(10),4)
  59. 640 c$(a(11),1)="[144][169] [223][146]":c$(a(29),1)=c$(a(11),1):rem barn
  60. 650 c$(a(11),2)="[180] [170][146]":c$(a(29),2)=c$(a(11),2)
  61. 660 c$(a(11),3)="[188] [190][146]":c$(a(29),3)=c$(a(11),3)
  62. 670 c$(a(11),4)="[180][144] [170][146]":c$(a(29),4)=c$(a(11),4)
  63. 680 c$(a(12),1)="   ":c$(a(30),1)=c$(a(12),1):rem ant
  64. 690 c$(a(12),2)="[144]v  ":c$(a(30),2)=c$(a(12),2)
  65. 700 c$(a(12),3)="[209]  ":c$(a(30),3)=c$(a(12),3)
  66. 710 c$(a(12),4)="[166][191][191]":c$(a(30),4)=c$(a(12),4)
  67. 720 c$(a(13),1)="   ":c$(a(31),1)=c$(a(13),1):rem bull
  68. 730 c$(a(13),2)="[144][202][162][203]":c$(a(31),2)=c$(a(13),2)
  69. 740 c$(a(13),3)=" [187] [146]":c$(a(31),3)=c$(a(13),3)
  70. 750 c$(a(13),4)=" [182][182]":c$(a(31),4)=c$(a(13),4)
  71. 760 c$(a(14),1)="   ":c$(a(32),1)=c$(a(14),1):rem bee
  72. 770 c$(a(14),2)="[144]v( ":c$(a(32),2)=c$(a(14),2)
  73. 780 c$(a(14),3)="[209][158] [144] ":c$(a(32),3)=c$(a(14),3)
  74. 790 c$(a(14),4)=" [173][173]":c$(a(32),4)=c$(a(14),4)
  75. 800 c$(a(15),1)="[149]  [162]":c$(a(33),1)=c$(a(15),1):rem boot
  76. 810 c$(a(15),2)="  [220][146]":c$(a(33),2)=c$(a(15),2)
  77. 820 c$(a(15),3)="[172][255] [146]":c$(a(33),3)=c$(a(15),3)
  78. 830 c$(a(15),4)="[188][162][162][146]":c$(a(33),4)=c$(a(15),4)
  79. 840 c$(a(16),1)="[149] [255] ":c$(a(34),1)=c$(a(16),1):rem cowboy
  80. 850 c$(a(16),2)="[183]o[144][183]":c$(a(34),2)=c$(a(16),2)
  81. 860 c$(a(16),3)="( [146])":c$(a(34),3)=c$(a(16),3)
  82. 870 c$(a(16),4)="[144][182][183][181]":c$(a(34),4)=c$(a(16),4)
  83. 880 c$(a(17),1)=":  [146]":c$(a(35),1)=c$(a(17),1):rem flag
  84. 890 c$(a(17),2)=":  [146]":c$(a(35),2)=c$(a(17),2)
  85. 900 c$(a(17),3)="   [146]":c$(a(35),3)=c$(a(17),3)
  86. 910 c$(a(17),4)="[144][182][146]  ":c$(a(35),4)=c$(a(17),4)
  87. 920 c$(a(18),1)="   ":c$(a(36),1)=c$(a(18),1):rem tractor
  88. 930 c$(a(18),2)="[172][188][146][215]":c$(a(36),2)=c$(a(18),2)
  89. 940 c$(a(18),3)="[161][162][187][146]":c$(a(36),3)=c$(a(18),3)
  90. 950 c$(a(18),4)="[144][215] o":c$(a(36),4)=c$(a(18),4)
  91. 960 print"":forx=1to4
  92. 970 print"   [215]   [215]   [215]   [215]   [215]   [215]   [215]   [215]   [215]":next
  93. 980 w=1:v=1:tr=0:pc=1:pe=0:forx=1tok:sc(x)=0:next
  94. 985 ifk>1thenprint"";p$(1);", you begin"
  95. 990 ifk=1thenprint"tries ="tr"        matches ="tl:poke198,.
  96. 995 rem main play
  97. 1000 jy=peek(56320):fi=jyand16:jy=15-(jyand15):bl=pl:pokepl,87:pokepl+co,1
  98. 1001 geta$:ifa$="[145]"thenjy=1
  99. 1002 ifa$="q"then80
  100. 1004 ifa$="[145]"thenjy=1
  101. 1005 ifa$=""thenjy=2
  102. 1006 ifa$=""thenjy=8
  103. 1007 ifa$="[157]"thenjy=4
  104. 1008 ifa$=chr$(13)thenfi=.
  105. 1010 ifjy=1orjy=5orjy=9thenpl=pl-200:goto 1050
  106. 1020 ifjy=2orjy=6orjy=10thenpl=pl+200:goto1050
  107. 1030 ifjy>3andjy<7thenpl=pl-4
  108. 1040 ifjy>7thenpl=pl+4
  109. 1050 p$=p$(w):ifk=1thenp$="well done"
  110. 1060 ifpe=81thenpokebl,81:pokebl+co,pc
  111. 1070 pe=peek(pl):pc=peek(pl+co)
  112. 1080 ifpe<>87andpe<>81thenpl=bl:pe=peek(pl):pc=peek(pl+co)
  113. 1090 pokepl,160:pokepl+co,z(w):fortt=1to70:nexttt
  114. 1100 ifpe=81then1000
  115. 1110 iffi<>16then1130
  116. 1120 goto1000
  117. 1130 forx=1to36:ifpl=d(x)thenz=x:f(v)=pl:goto1150
  118. 1140 next
  119. 1150 ifv=1thens=z:goto1180
  120. 1160 ifz=sthen1000
  121. 1170 print"                                        ":t=z:goto1190
  122. 1180 forx=1to4:printl$(s);c$(s,x):nextx:v=2:goto1000
  123. 1190 forx=1to4:printl$(t);c$(t,x):nextx:v=1:tr=tr+1
  124. 1200 ifc$(s,3)<>c$(t,3)then1280
  125. 1210 gosub1350:print"";z$(w);p$;", you got a match!!!"
  126. 1220 gosub1680:sc(w)=sc(w)+1:tl=tl+1
  127. 1230 pokef(1),81:pokef(1)+co,z(w):pokef(2),81
  128. 1235 pokef(2)+co,z(w):pe=81:pc=z(w)
  129. 1240 fortt=1to100:nexttt
  130. 1250 iftl=18then1360
  131. 1260 ifk=1then1340
  132. 1270 gosub1350:print"";z$(w);"you get to go again!":goto1000
  133. 1280 gosub1350:print"";z$(w);"sorry, ";p$(w);"..."
  134. 1290 fora=1to500:next
  135. 1300 printl$(s);"[158][207][183][208][157][157][157][181][191][182][157][157][157][181][191][182][157][157][157][204][175][186]"
  136. 1310 printl$(t);"[207][183][208][157][157][157][181][191][182][157][157][157][180][191][182][157][157][157][204][175][186]":ifk=1then1340
  137. 1320 w=w+1:ifw>kthenw=1
  138. 1330 gosub1350:print"";z$(w);"it's ";p$(w);"'s turn":goto1000
  139. 1340 gosub1350:print"tries = "tr"        matches ="tl:goto1000
  140. 1350 print"                                        ":return
  141. 1360 rem end of game
  142. 1370 print"[147]":print:g=g+1:ifg>10theng=1:h=1
  143. 1380 ifk=1then1550
  144. 1390 print"there was a total of 18 matches:":print
  145. 1400 forx=1tok:print"     ";p$(x);" found "sc(x)" of them":next
  146. 1410 h(g)=sc(1):forx=2tok:ifsc(x)>h(g)thenh(g)=sc(x)
  147. 1415 next
  148. 1420 print:print"winners...":print
  149. 1430 forx=1tok:ifsc(x)<>h(g)then1470
  150. 1440 le=18-len(p$(x)):print"game"g"    ";p$(x);spc(le);h(g)
  151. 1450 h=h+1:w$(h)=p$(x):hs(h)=h(g):g(h)=g:le(h)=le
  152. 1460 fort=1to100:nextt
  153. 1470 next
  154. 1480 print:ifg=1then1510
  155. 1490 forx=1toh:print"game"g(x)"[146]     ";w$(x);"[146]";spc(le(x));""hs(x)"[146]"
  156. 1500 next
  157. 1510 print:print"   press the space bar to play again"
  158. 1512 print"            press 'q' to quit"
  159. 1515 getjunk$:ifjunk$<>""then1515
  160. 1520 getq$:ifq$=""then1520
  161. 1525 ifq$="q"then60000
  162. 1530 ifq$=chr$(32)then275
  163. 1540 end
  164. 1550 rem one player statistics
  165. 1560 tr(g)=tr
  166. 1570 iftr<26thenprint"wow!!!":goto1600
  167. 1580 iftr<36thenprint"congratulations!":goto1600
  168. 1590 print"good try!"
  169. 1600 print"it took you"tr"tries to find the 18     matches."
  170. 1610 ifg=1then1640
  171. 1620 print:print"your standings...":print
  172. 1630 forx=1tog:print"game"x"[146]     "tr(x)"[146]":next
  173. 1640 print:print"would you like to try again? (y/n)"
  174. 1650 getjunk$:ifjunk$<>""then1650
  175. 1655 getq$:ifq$=""then1655
  176. 1660 ifq$="y"then275
  177. 1670 goto60000
  178. 1680 rem music
  179. 1690 forx=0to23:pokeso+x,0:next
  180. 1700 pokeso+2,255:pokeso+5,9:pokeso+24,15
  181. 1710 forx=1to8
  182. 1720 pokeso+1,n3(x):pokeso,n4(x)
  183. 1730 pokeso+4,65:fort=1todr(x):nextt
  184. 1740 pokeso+4,64
  185. 1750 nextx
  186. 1760 return
  187. 1790 print"[147]":poke53281,0:poke53280,0:co=54272
  188. 1800 so=co:forx=0to23:pokeso+x,0:next:pokeso+2,255:pokeso+5,9:pokeso+24,15
  189. 1810 forx=1to33:readn1(x),n2(x):next
  190. 1820 forx=1to20:reads(x):t(x)=s(x):next
  191. 1830 rem card designs 1-9
  192. 1840 b$(1,1)=" [206][181]":b$(1,2)="[206] [181]":rem sailboat
  193. 1850 b$(1,3)="[183][183][181]":b$(1,4)="[223] [146][169]"
  194. 1860 b$(2,1)="   ":b$(2,2)=" ( ":r